#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+50;
const int INF=2e9+50;
int n;
struct rec{
    ll xl,yl,xr,yr;
}a[N],l[N],r[N],re;
//判断是否满足矩形
bool judge(rec r){
    //printf("%lld %lld %lld %lld\n",r.xl,r.xr,r.yl,r.yr);
    return r.xl<=r.xr && r.yl<=r.yr;
}
int main(void){
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%lld%lld%lld%lld",&a[i].xl,&a[i].yl,&a[i].xr,&a[i].yr);
    }
    //矩形交前缀和
    l[0].xl=l[0].yl=-INF;
    l[0].xr=l[0].yr=INF;
    for(int i=1;i<=n;i++){
        l[i].xl=max(a[i].xl,l[i-1].xl);
        l[i].yl=max(a[i].yl,l[i-1].yl);
        l[i].xr=min(a[i].xr,l[i-1].xr);
        l[i].yr=min(a[i].yr,l[i-1].yr);
    }
    r[n+1].xl=r[n+1].yl=-INF;
    r[n+1].xr=r[n+1].yr=INF;
    for(int i=n;i>=1;i--){
        r[i].xl=max(a[i].xl,r[i+1].xl);
        r[i].yl=max(a[i].yl,r[i+1].yl);
        r[i].xr=min(a[i].xr,r[i+1].xr);
        r[i].yr=min(a[i].yr,r[i+1].yr);
    }
    if(judge(l[n-1])){
        //前n-1个矩形交前缀和合法  
        printf("%lld %lld\n",l[n-1].xl,l[n-1].yl);
    }else if(judge(r[2])){
        //后n-1个矩形交前缀和合法
        printf("%lld %lld\n",r[2].xl,r[2].yl);
    }else{
        //枚举不存在的那个
        for(int i=2;i<=n-1;i++){
            //取剩下n-1个矩形的交,判断是否合法
            re.xl=max(l[i-1].xl,r[i+1].xl);
            re.yl=max(l[i-1].yl,r[i+1].yl);
            re.xr=min(l[i-1].xr,r[i+1].xr);
            re.yr=min(l[i-1].yr,r[i+1].yr);
            if(judge(re)){
                printf("%lld %lld\n",re.xl,re.yl);
                break;
            }
        }
    }
    return 0;
}